<template>
    <div>
        <div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-calendar"></i> 应聘者管理
                </el-breadcrumb-item>
                <el-breadcrumb-item>添加应聘者信息</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="container">
            <div class="form-box">
                <el-form ref="form" :model="form" label-width="80px">
                    <el-form-item label="姓名">
<<<<<<< HEAD
                        <el-input v-model="form.canName"></el-input>
                    </el-form-item>
                    <el-form-item label="年龄">
                        <el-input v-model="form.canAge"></el-input>
=======
                        <el-input v-model="form.canName" placeholder="请输入"></el-input>
                    </el-form-item>
                    <el-form-item label="年龄">
                        <el-input v-model="form.canAge" placeholder="请输入"></el-input>
>>>>>>> a6928a3 (+)
                    </el-form-item>
                    <el-form-item label="性别">
                        <el-radio-group v-model="canGender1">
                            <el-radio label="男"></el-radio>
                            <el-radio label="女"></el-radio>
                        </el-radio-group>
                    </el-form-item>
                    <el-form-item label="工作经验">
                        <el-cascader :options="options1" v-model="form.canExperience"></el-cascader>
                    </el-form-item>
                    <el-form-item label="学历">
                        <el-cascader :options="options4" v-model="form.canIdentify"></el-cascader>
                    </el-form-item>
                    <el-form-item label="应聘部门">
                        <el-cascader :options="options2" v-model="form.canDep"></el-cascader>
                    </el-form-item>
                    <el-form-item label="期望岗位">
                        <el-cascader :options="options3" v-model="form.canWantPosition"></el-cascader>
                    </el-form-item>
                    <el-form-item label="面试级别">
<<<<<<< HEAD
                        <el-input v-model="form.canGrade"></el-input>
                    </el-form-item>
                    <el-form-item label="本人照片">
                        <el-input v-model="form.canHead"></el-input>
=======
                        <el-input v-model="form.canGrade" placeholder="请输入"></el-input>
                    </el-form-item>
                    <el-form-item label="本人照片">
                        <el-input v-model="form.canHead" placeholder="请输入"></el-input>
>>>>>>> a6928a3 (+)
                    </el-form-item>
                    <el-form-item label="投递日期">
                        <el-date-picker
                        v-model="form.canDate"
                        type="date"
                        placeholder="选择日期"
                        format="yyyy 年 MM 月 dd 日"
                        value-format="yyyy-MM-dd">
                        </el-date-picker>
                        <!-- <el-col :span="11">
                            <el-date-picker
                                type="date"
                                placeholder="选择日期"
                                v-model="date1"
                                style="width: 100%;"
                            ></el-date-picker>
                        </el-col>
                        <el-col class="line" :span="2">-</el-col> -->
                        <!-- <el-col :span="11">
                            <el-time-picker
                                placeholder="选择时间"
                                v-model="date2"
                                style="width: 100%;"
                            ></el-time-picker>
                        </el-col> -->
                    </el-form-item>
                    <el-form-item label="电话">
<<<<<<< HEAD
                        <el-input v-model="form.canPhone"></el-input>
                    </el-form-item>
                    <el-form-item label="相关能力">
                        <el-input type="textarea" rows="5" v-model="form.canPower"></el-input>
                    </el-form-item>
                    <el-form-item label="期望薪资">
                        <el-input v-model="form.canSalary"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">提交</el-button>
                        <el-button>取消</el-button>
=======
                        <el-input v-model="form.canPhone" placeholder="请输入"></el-input>
                    </el-form-item>
                    <el-form-item label="相关能力">
                        <el-input type="textarea" rows="5" v-model="form.canPower" placeholder="请输入"></el-input>
                    </el-form-item>
                    <el-form-item label="期望薪资" >
                        <el-input v-model="form.canSalary" placeholder="请输入"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="onSubmit">提交</el-button>
                        <el-button @click="onCancl">取消</el-button>
>>>>>>> a6928a3 (+)
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'addC',
    data() {
        return {
            options1: [
                    {
<<<<<<< HEAD
                        value:"1",
                        label:"1年"
                    },
                    {
                        value:"2",
                        label:"2年"
                    },
                    {
                        value:"3",
                        label:"3年"
                    },
                    {
                        value:"4",
                        label:"4年"
                    },
                    {
                        value:"5",
                        label:"5年"
                    },
                    {
                        value:"6",
                        label:"6年"
                    },
                    {
                        value:"7",
                        label:"7年"
                    },
                    {
                        value:"8",
                        label:"8年"
                    },
                    {
                        value:"9",
                        label:"9年"
                    },
                    {
                        value:"10",
=======
                        value:1,
                        label:"1年"
                    },
                    {
                        value:2,
                        label:"2年"
                    },
                    {
                        value:3,
                        label:"3年"
                    },
                    {
                        value:4,
                        label:"4年"
                    },
                    {
                        value:5,
                        label:"5年"
                    },
                    {
                        value:6,
                        label:"6年"
                    },
                    {
                        value:7,
                        label:"7年"
                    },
                    {
                        value:8,
                        label:"8年"
                    },
                    {
                        value:9,
                        label:"9年"
                    },
                    {
                        value:10,
>>>>>>> a6928a3 (+)
                        label:"10年以上"
                    }
            ],
            options2: [
                {
                    value:1,
                    label:"技术部"
                },
                {
                    value:2,
                    label:"推广部"
                },
                {
                    value:3,
                    label:"客服部"
                },
                {
                    value:4,
                    label:"行政部"
                },
                {
                    value:5,
                    label:"财务部"
                }
            ],
            options3: [
                {
                    value:"架构师",
                    label:"架构师"
                },
                {
                    value:"web前端工程师",
                    label:"web前端工程师"
                },
                {
                    value:"运维工程师",
                    label:"运维工程师"
                },
                {
                    value:"后端开发工程师",
                    label:"后端开发工程师"
                },
                {
                    value:"测试开发工程师",
                    label:"测试开发工程师"
                }
            ],
            options4:[
                {
<<<<<<< HEAD
                    value:"高中",
                    label:"高中"
                },
                {
                    value:"大专",
                    label:"大专"
                },
                {
                    value:"本科",
                    label:"本科"
                },
                {
                    value:"硕士",
                    label:"硕士"
                },
                {
                    value:"博士",
=======
                    value:1,
                    label:"高中"
                },
                {
                    value:2,
                    label:"大专"
                },
                {
                    value:3,
                    label:"本科"
                },
                {
                    value:4,
                    label:"硕士"
                },
                {
                    value:5,
>>>>>>> a6928a3 (+)
                    label:"博士"
                }
            ],
            canGender1:'男',
            form: {
<<<<<<< HEAD
                canAge:'',
                canDate:'',
                canDep:'',
                canExperience:'',
                canGender:1,
                canGrade:'',
                canHead:'',
                canId:'',
                canIdentify:'',
                canName: '',
                canPhone:'',
                canPower:'',
                canSalary:'',
=======
                canAge:0,
                canDate:0,
                canDep:0,
                canExperience:0,
                canGender:1,
                canGrade:0,
                canHead:'',
                canIdentify:0,
                canName: '',
                canPhone:0,
                canPower:'',
                canSalary:0,
>>>>>>> a6928a3 (+)
                canWantPosition:''
            }
        };
    },
    methods: {
        onSubmit() {
            const _this=this;
<<<<<<< HEAD
            console.log(_this.form.canDate)
            if(_this.canGender1 === '女')
                _this.form.canGender = 0;
=======
            if(_this.canGender1 === '女')
                _this.form.canGender = 0;
            // _this.form.canAge = parseInt(_this.form.canAge);
            _this.form.canDep = _this.form.canDep[0];
            _this.form.canExperience = _this.form.canExperience[0];
            _this.form.canWantPosition = _this.form.canWantPosition[0];
            // _this.form.canId = parseInt(_this.form.canId);
            _this.form.canIdentify = _this.form.canIdentify[0];
            // _this.form.canPhone = parseInt(_this.form.canPhone);
            // _this.form.canSalary = parseInt(_this.form.canSalary);
>>>>>>> a6928a3 (+)
             this.$axios
                .post('/Candidate/addCandidate', _this.form, {
                    headers: {
                        Authorization: sessionStorage.getItem('token')
                    }
                })
                .then(res => {
                    console.log(res)
                    if (res.data.code === 200) {
                        this.$message.success(res.data.msg);
<<<<<<< HEAD
=======
                        _this.form={};
                        this.$router.push('/');
>>>>>>> a6928a3 (+)
                    } else {
                        this.$message.error(res.data.msg);
                    }
                });
<<<<<<< HEAD
=======
        },
        onCancl() {
            this.$router.push('/');
>>>>>>> a6928a3 (+)
        }
    }
};
</script>